package chapter_03.list_stack_queue;

/**
 * 栈的链表实现
 */
public class MyLinkedStack {
    private MySingleLinkedList<Object> data;
    private int top;

    public MyLinkedStack() {
        data = new MySingleLinkedList<>();
        top = -1;
    }

    public void push(Object obj) {
        data.add(obj);
    }

    public Object pop() {
        return data.remove(data.getSize());
    }

    public Object peek() {
        return data.get(data.getSize());
    }
}
